#include <retro.h>
#include "retro.creator.h"

INT CALLBACK _tWinMain(
  __in  HINSTANCE hInstance,
  __in  HINSTANCE hPrevInstance,
  __in  LPTSTR lpCmdLine,
  __in  INT nCmdShow)
{
    INT wNumArgs;
    PTSTR* wArgs = CommandLineToArgvW(GetCommandLine(), &wNumArgs);

    LoadLibrary(_T("scintilla.dll"));
    LoadLibrary(_T("splib.dll"));

    InitCommonControls();
    Windows::initWindows();

    Retro::Initialize(TRUE);
    Retro::Creator::Frame::start(wNumArgs >= 2 ? wArgs[1] : NULL);
    Retro::Uninitialize();

    Windows::uninitWindows();

    return EXIT_SUCCESS;
}